from fastapi import APIRouter, Query
from core.schemas.pagination import PaginatedResponse
from src.modules.knowbase.services.Impl.imagevector_service import ImageVectorService
from core.schemas.response import success

router = APIRouter(prefix="/iv",tags = ["iv"])

@router.get("/list",response_model= PaginatedResponse)
async def get_iv_list(
        user_id: str = Query(None, description="用户id"),
        file_id: str = Query(None, description="文件id"),
        kb_id: str = Query(None, description="知识库id"),
        page: int = Query(1, description="页码", ge=1),
        page_size: int = Query(10, description="每页条数", le=100)
):
    result = await ImageVectorService.get_imagevector_list(
        user_id, file_id, kb_id, page, page_size
    )
    return success(data=result)


@router.delete("/delete")
async def delete_vector(vector_id:str):
    result = await ImageVectorService.delete_vector(vector_id)
    return success(data=result)


@router.put("/update")
async def update_image_vector_by_id(vector_id:str, image_desc:str):
    result = await ImageVectorService.update_image_vector_by_id(vector_id, image_desc)
    return success(data = result)
